import { msOfDay } from "./constants"

export function getEndTimeOfWeek(date: Date, deltaDay: number = 0): Date {
  const d = new Date(Date.now() + deltaDay * msOfDay)
  const w = d.getDay() || 7
  d.setDate(d.getDate() - w + 1)
  return new Date(d.getFullYear(), d.getMonth(), d.getDate(), 23, 59, 59, 999)
}
